<!doctype html>
<html>

	<head></head>
	<meta charset="utf-8" />
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title>会员注册</title>
	<link rel="stylesheet" href="http://www.xyshopping.com:8848/qianduan/resources/css/bootstrap.min.css" type="text/css" />
	<script src="http://www.xyshopping.com:8848/qianduan/resources/js/jquery-1.11.3.min.js" type="text/javascript"></script>
	<script src="http://www.xyshopping.com:8848/qianduan/resources/js/bootstrap.min.js" type="text/javascript"></script>
	<script type="text/javascript" src="http://www.xyshopping.com:8848/qianduan/resources/js/jquery-heima-0.0.1.js" ></script>
	<script type="text/javascript" src="http://www.xyshopping.com:8848/qianduan/resources/js/heima-include.js" ></script>
	<script>
		/**
		 * 为注册按钮绑定点击事件; 
		 * 获取表单数据，通过ajax把数据发送给服务器
		 * 登录成功，跳转到登录页面
		 */
		$(function(){
			$("#registBtn").click(function(){
				//使用jquery的serializa()方法来获取页面参数
				var params = $("form").serialize();
				
				//把参数发送给后端服务器
				HM.ajax("/user?md=register",params,function(vo){
					//假设登录成功
					if(vo.code == 1){
						//跳转到登录页面
						location.href="login.html";
					}else{
						//登录失败
						var errorStr = vo.data;
						$("#username_error").html(errorStr).css("color","red");
					}
				})
			})
		})
	</script>
	<style>
	</style>
	</head>
	<body>
		<div class="container-fluid">
			<!--头部-->
			<div id="header" style="min-height: 130px;"></div>
			<div class="container-fluid" style="width:98%;background:url('http://www.xyshopping.com:8848/qianduan/resources/img/regist_bg.jpg');">
				<div class="row">
					<div class="col-md-2"></div>
					<div class="col-md-8" style="background:#fff;padding:40px 80px;margin:30px;border:7px solid #ccc;">
						<font style="color: #3164af;font-size: 18px;font-weight: normal;padding: 0 10px;">会员注册</font>USER REGISTER
						<form class="form-horizontal" style="margin-top:5px;">
							<div class="form-group">
								<label for="username" class="col-sm-2 control-label">用户名</label>
								<div class="col-sm-6">
									<input type="text" class="form-control" id="username" placeholder="请输入用户名" name="username">
									<span id="username_error"></span>
								</div>
							</div>
							<div class="form-group">
								<label for="inputPassword3" class="col-sm-2 control-label">密码</label>
								<div class="col-sm-6">
									<input type="password" class="form-control" id="inputPassword3" placeholder="请输入密码" name="password">
								</div>
							</div>
							<div class="form-group">
								<label for="confirmpwd" class="col-sm-2 control-label">确认密码</label>
								<div class="col-sm-6">
									<input type="password" class="form-control" id="confirmpwd" placeholder="请输入确认密码">
								</div>
							</div>
							<div class="form-group">
								<label for="inputEmail3" class="col-sm-2 control-label">Email</label>
								<div class="col-sm-6">
									<input type="email" class="form-control" id="inputEmail3" placeholder="Email" name="email">
								</div>
							</div>
							<div class="form-group">
								<label for="usercaption" class="col-sm-2 control-label">姓名</label>
								<div class="col-sm-6">
									<input type="text" class="form-control" id="usercaption" placeholder="请输入姓名" name="name">
								</div>
							</div>
							<div class="form-group opt">
								<label for="inlineRadio1" class="col-sm-2 control-label">性别</label>
								<div class="col-sm-6">
									<label class="radio-inline">
									  <input type="radio" name="gender" id="inlineRadio1" value="1"> 男
									</label>
									<label class="radio-inline">
									  <input type="radio" name="gender" id="inlineRadio2" value="0"> 女
									</label>
								</div>
							</div>
							<div class="form-group">
								<label for="date" class="col-sm-2 control-label">出生日期</label>
								<div class="col-sm-6">
									<input type="date" class="form-control" name="birthday">
								</div>
							</div>
	
							<div class="form-group">
								<label for="date" class="col-sm-2 control-label">验证码</label>
								<div class="col-sm-3">
									<input type="text" class="form-control">
	
								</div>
								<div class="col-sm-2">
									<img src="http://www.xyshopping.com:8848/qianduan/resources/img/captcha.png" />
								</div>
	
							</div>
							<!-- 修改submit为button， 使用ajax提交数据 -->
							<div class="form-group">
								<div class="col-sm-offset-2 col-sm-10">
									<input type="button" width="100" value="注册" id="registBtn" border="0" style="background-color:#CD062D;height:35px;width:100px;color:white;">
								</div>
							</div>
						</form>
					</div>
	
					<div class="col-md-2"></div>
	
				</div>
			</div>
			<!--尾部-->
			<div id="footer"  style="min-height: 203px;"></div>
		</div>
	</body>
</html>